package com.xindaoapp.happypet.activity;

import android.content.Intent;
import android.os.Bundle;

import com.umeng.analytics.MobclickAgent;
import com.xindao.photonics.fragments.manager.BaseFragment;
import com.xindao.photonics.fragments.manager.BaseFragmentActivity;
import com.xindaoapp.happypet.R;
import com.xindaoapp.happypet.utils.Constants;
import com.xindaoapp.happypet.utils.LoginManager;

/**
 * String className = getIntent().getStringExtra(Constants.KEY_SKIP_CLASS_NAME);<br/>
 * BundleExtra(Constants.KEY_BUNDLE)
 * 
 * @author chenghao
 * 
 */
// @Deprecated
public class MainActivity extends BaseFragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_container);
        String className = getIntent().getStringExtra(Constants.KEY_SKIP_CLASS_NAME);
        try {
            startFragment((BaseFragment) Class.forName(className).newInstance(), getIntent()
                    .getBundleExtra(Constants.KEY_BUNDLE));
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (LoginManager.mSsoHandler != null) {
            LoginManager.mSsoHandler.authorizeCallBack(requestCode, resultCode, data);
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onResume() {
        super.onResume();
        MobclickAgent.onPageStart(getPackageName());
        MobclickAgent.onResume(this);
    }

    @Override
    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd(getPackageName());
        MobclickAgent.onPause(this);
    }



}
